package com.hotai.controller;

import com.hotai.comment.dtos.ResponseResult;
import com.hotai.service.CoursewareService;
import com.hotai.service.UserTeacherService;
import com.hotai.vo.courseware.CoursewareList;
import com.hotai.vo.courseware.CoursewaredetaileList;
import com.hotai.vo.sho.GuanSho;
import com.hotai.vo.sho.TearSho;
import com.hotai.vo.sho.XueSho;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/Sho")
@CrossOrigin
public class ShoController {

    @Autowired
    private CoursewareService coursewareService;

    @Autowired
    private UserTeacherService userTeacherService;


//管理端首页
    @RequestMapping("/guanli")
    private ResponseResult guanSho(GuanSho guanSho ){
        return    coursewareService.guanShoPage(guanSho);
    }

    //管理端首页上
    @RequestMapping("/guanlishang")
    private ResponseResult guanSho(){
        return    coursewareService.guanShoShangPage();
    }

    //设备端首页
    @RequestMapping("/Stu")
    private ResponseResult XueSho(XueSho xueSho ){
        return    coursewareService.StuShoPage(xueSho);
    }

//设备端历史记录
    @RequestMapping("/StuShi")
    private ResponseResult XueShoshi(CoursewaredetaileList  queryware ){
        return    coursewareService.Stushi(queryware);
    }
    //课件下载
    @RequestMapping("/download")
    private ResponseResult  Xiadownload(@Param("id") Integer id){
        return    coursewareService.downloadXia(id);
    }

    //设备端热门TOP
    @RequestMapping("/StuTOP")
    private ResponseResult XueTOP(@Param("fname") String  fname,@Param("xid") String xid){
        return    coursewareService.StuTop(fname,xid);
    }

    //设备端课件TOP
    @RequestMapping("/CourseTOP")
    private ResponseResult CourseTOP(@Param("id") Integer id, @Param("xid") String xid, HttpServletRequest request){
        return    coursewareService.WareTop(id,xid,request);
    }

    //设备端历史删除
    @RequestMapping("/StuShiDelete")
    private ResponseResult XueShoshiDelte(@Param("id") Integer id){
        return    coursewareService.StushiDelete(id);
    }

    //教师端首页
    @RequestMapping("/Tear")
    private ResponseResult TearSho(TearSho tearSho ){
        return    userTeacherService.TeaShoPage(tearSho);
    }
    //报告
    @RequestMapping("/BaoGao")
    private ResponseResult XuexiBao(@Param("id") Integer id){
        return    coursewareService.Bao(id);
    }
   //报告里面平均时长
    @RequestMapping("/pin")
    private ResponseResult Xuexipin(@Param("sid") Integer sid,@Param("cid") Integer cid){
        return    coursewareService.pin(sid,cid);
    }

    //报告里面步骤
    @RequestMapping("/bu")
    private ResponseResult Xuebu(@Param("id") Integer id){
        return    coursewareService.bu(id);
    }






}
